package com.depthsdata.coe.api;

import org.apache.commons.lang3.StringUtils;

import com.depthsdata.coe.dao.BusinessUnitDAOQueryBean;
import com.depthsdata.coe.service.BusinessUnitBean;
import com.ourteam.frame.web.AbstractSearchModel;

public class BusinessUnitSearchBean extends AbstractSearchModel<BusinessUnitDAOQueryBean> {

	private String businessUnitName;

	public String getBusinessUnitName() {
		return businessUnitName;
	}

	public void setBusinessUnitName(String businessUnitName) {
		this.businessUnitName = businessUnitName;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return BusinessUnitBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(BusinessUnitDAOQueryBean queryBean) throws Exception {

		BusinessUnitDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (StringUtils.isNotBlank(businessUnitName)) {

			criteria.andBusinessUnitNameLike(businessUnitName);
		}

	}

}
